home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1993 July / Internet Tools.iso / RockRidge / security / netlog-1.02 / nstat / README.nstat < prev    next >
Encoding:
Text File  |  1993-06-18  |  4.6 KB  |  123 lines

  1.  
  2. Introduction:
  3.  
  4. The nstat series of network monitor and analysis tools are useful
  5. for determining a segment's overall load and utilization by service.
  6. This can be used for capacity planning, determining usage policies,
  7. and for spotting clandestine services. (Can you say FSP?)
  8.  
  9. This package includes three programs:
  10.     nstat.c - data collection program
  11.     nsum    - perl program to print summary histogram
  12.     nload   - awk program to collate data for plotting by xvgr
  13.  
  14. The nstat data collection program runs on SunOS 4.1.X, using NIT.
  15.  
  16. You may ask "why not use NNstat?"  Nstat counts packets and bytes
  17. going to *and from* *all* IP ports. Unfortunately, NNstat does not
  18. easily lend itself to this type of collection, as it is simple to
  19. collect data for packets to *all* ports, or *to and from* specified
  20. ports, but not both.
  21.  
  22. Using the programs:
  23.  
  24. 1. nstat - network utilization statistics collector
  25.  
  26.     nstat [-i interface][-t time interval (sec)]
  27.  
  28. The interface defaults to "le0", and the time interval to 3600 seconds
  29. (1 hour). Nstat collects data during the interval, then prints out the 
  30. raw data in a concise ascii format (to stdout), and resets all counters.
  31. The following is some sample output:
  32.  
  33. #Start Tue May 25 09:21:37 1993
  34. #Stop  Tue May 25 10:21:38 1993
  35. #881974 packets, 146774562 bytes, 19188 802.3, 4 runt, 2762 missed.
  36. e 600   # 300   b 24758
  37. e 800   # 692101        b 125706982
  38. ...
  39. i 1     # 1027  b 79884
  40. i 6     # 658235        b 121349056
  41. i 9     # 135   b 166230
  42. i 17    # 32227 b 4075291
  43. ...
  44. t 20    # 106475        b 41135245
  45. t 21    # 4734  b 355764
  46. t 23    # 108485        b 9856094
  47. t 25    # 70396 b 18252107
  48. ...
  49. u 53    # 17953 b 1877980
  50. u 67    # 4     b 1368
  51. u 68    # 4     b 1368
  52.  
  53. In this output format, The "Start" and "Stop" lines give the time
  54. period covered. The third "comment" line gives the total number of
  55. packets, bytes, 802.3 packets, runt packets, and dropped packets
  56. during the period.  The subsequent "e", "i", "t", and "u" lines
  57. give details on ethernet types, IP protocols, TCP ports and UDP ports,
  58. respectively.  On each line, the second field specifies the type,
  59. protocol, or port. The number following the "#" is the number of packets,
  60. and the number following the "b" is the number of bytes.
  61. Note that the ethernet type is given in hex, and all other numbers are
  62. in decimal.  In addition, note that every IP packet is counted twice:
  63. once for the source port, and once for the destination port. This is
  64. done so that the numbers for each service (port) include both directions
  65. of data flow.  The trick is to remember to divide by two if summing
  66. all tcp and udp values.
  67.  
  68.  
  69. 2. nsum - make histogram summary of nstat logs
  70.  
  71.     nsum [- M | A | D | E | N ] [- w | W ] [ filename ... ]
  72.                M = morning (8am-11am)
  73.                A = afternoon (noon - 5pm)
  74.                D = day  (morning | afternoon)
  75.                E = evening (6pm - 11pm)
  76.                N = night (midnignt - 7am)
  77.  
  78.                w = workday
  79.                W = weekend
  80.  
  81. nsum is a perl program that accepts nstat logs (from files or stdin),
  82. and sumarizes the top ten ethernet, IP, TCP, and UDP usages.  The
  83. optional time or date switches allow you to restrict analysis to the
  84. specified periods. The output is a simple ascii histogram in which each
  85. '#' represents 1 percent.  Each line also gives the utilization
  86. numerically, the first number giving the percent of bytes seen in the
  87. category, the second number giving the percent of total bandwidth.
  88. Note that the total bandwidth of the link needs to be modified for your
  89. situation.  Here is a snippet from an example output:
  90. ...
  91. ETH oldIPX    ( 4%/ 3%):####
  92. ...
  93. IP  UDP      ( 6%/ 5%):######
  94. ...
  95. TCP ftp-data (30%/24%):##############################
  96. ...
  97. UDP route    (28%/ 1%):############################
  98. ...
  99.  
  100.  
  101. 3. make a simple network load graph
  102.  
  103. Since the nstat output is relatively easy to parse with AWK, you
  104. can make a simple overall load graph with:
  105.  
  106. cat nstat.log.*.Z|awk '/packet/ { print ($3/(1728*1024) ) }'- \
  107.     |xvgr -source stdin
  108.  
  109. Note that the "1728*1024" is our bandwidth in bytes per hour,
  110. divided by 100 (to get %). (384Kbits/sec * 8 * 1024 bytes/K /100)
  111.  
  112. 4. nload - graph network utilization
  113.  
  114. Nload is a more complex example of using an AWK program and xvgr 
  115. parameter file to plot more detailed utilization graph. This program
  116. picks out details on our top services (FTP, NNTP, MUD, SMTP, and TELNET),
  117. and graphs their load, along with an "other" category in a convenient
  118. stacked bar format. Here again, the units are % of total bandwidth, 
  119. where our total bandwidth is specified with the "bph=1728*1024"
  120. declaration in nload. Here is an example invocation:
  121.  
  122. cat nstat.log.*.Z|awk -f nload -| xvgr -nxy -p nload.prm -source stdin
  123.